package ms;

import java.util.Scanner;

public class ShortSequence {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int numberCount;
		int[] array;
		while(scanner.hasNext()){
			numberCount = scanner.nextInt();
			array = new int[numberCount];
			for (int i = 0; i < array.length; i++) {
				array[i] = scanner.nextInt();
			}
			getLast(array);
		}
		scanner.close();
	}
	public static void getLast(int[] array){
		int odd = 0, even = 0;
		for(int i = 0; i < array.length; i++){
			if((array[i] & 1) == 0){
				even++;
			}else{
				odd++;
			}
		}
		System.out.println(array.length - Math.min(odd, even) * 2);
	}
}
